/*
 *------------------------------------------------------------------------------
 * @File      :    ei_mai_smart_human.h
 * @Date      :    2021-4-8
 * @Author    :    lomboswer <lomboswer@lombotech.com>
 * @Brief     :    Media Interface for MADP(Media Development Platform).
 *
 * Copyright (C) 2020-2021, LomboTech Co.Ltd. All rights reserved.
 *------------------------------------------------------------------------------
 */

#ifndef __EI_SMART_HUMAN_H__
#define __EI_SMART_HUMAN_H__

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif

typedef struct eiMADP_SMART_HUMANDET_RESULT_S {
	/* x0,y0,x1,y1 */
	EI_S32 s32Rect[4];

	/* score */
	EI_FLOAT f32Score;

	/* area */
	EI_S32 s32Area;

	/* track falg */
	EI_S32 s32VisualTrack;

	EI_U64 u64Timestamp;
} EI_MADP_SMART_HUMANDET_RESULT_S;

typedef struct eiMADP_SMART_HUMANDET_RESULTS_S {
	EI_U32 s32Num;
	EI_MADP_SMART_HUMANDET_RESULT_S stHumans[DEFAULT_NNA_HUM_DET_CONFIG_MAX_DET];
	EI_U32 u32FrameWidth;
	EI_U32 u32FrameHeight;
	EI_U32 NnaHandle;
	EI_NNA_HUMANS_S stNnaDetResult;

} EI_MADP_SMART_HUMANDET_RESULTS_S;

typedef EI_S32 (*EI_MADP_SMART_HumanDet_DataCB) (EI_HANDLE hHumanDet, EI_MADP_SMART_FRAME_S *pstSmartFrame,
	EI_MADP_SMART_HUMANDET_RESULTS_S *pstHumanDetResults, EI_VOID *pPrivData);

/* the attribute of smart facedet */
typedef struct eiMADP_SMART_HUMANDET_ATTR_S {

	EI_U32 u32FrameWidth;
	EI_U32 u32FrameHeight;
	EI_S32 s32MaxHumanNum;

	EI_MADP_SMART_HumanDet_DataCB pfnDataCB;
	EI_VOID *pPrivateData;
} EI_MADP_SMART_HUMANDET_ATTR_S;

typedef struct eiMADP_SMART_HUMANTRK_RESULT_S {
	/* x0,y0,x1,y1 */
	EI_S32 s32Rect[4];

	/* score */
	EI_FLOAT f32Score;

	/* id */
	EI_S32 u32Id;

	/* area */
	EI_S32 s32Area;

	/* track falg */
	EI_S32 s32VisualTrack;

	EI_U64 u64Timestamp;
} EI_MADP_SMART_HUMANTRK_RESULT_S;

typedef struct eiMADP_SMART_HUMANTRK_RESULTS_S {
	EI_U32 s32Num;
	EI_MADP_SMART_HUMANTRK_RESULT_S stHumans[DEFAULT_NNA_HUM_TRK_CONFIG_MAX_TRACK_HUM];
	EI_U32 NnaHandle;
	EI_NNA_HUMANS_S stNnaTrkResult;
	EI_U64 u64Timestamp;
} EI_MADP_SMART_HUMANTRK_RESULTS_S;

typedef EI_S32 (*EI_MADP_SMART_HumanTrk_DataCB) (EI_HANDLE hHumanTrk, EI_MADP_SMART_FRAME_S *pstSmartFrame,
	EI_MADP_SMART_HUMANTRK_RESULTS_S *pstFaceTrkResults, EI_VOID *pPrivData);

/* the attribute of smart facetrk */
typedef struct eiMADP_SMART_HUMANTRK_ATTR_S {
	EI_U32 u32FrameWidth;
	EI_U32 u32FrameHeight;
	EI_S32 s32MaxHumanNum;

	EI_MADP_SMART_HumanTrk_DataCB pfnDataCB;
	EI_VOID *pPrivateData;
	void *reserved;
} EI_MADP_SMART_HUMANTRK_ATTR_S;

typedef struct eiMADP_SMART_HUMANSNAP_VENC_DATA_S {
	EI_VOID *pVStreamData;

	EI_U8 *pu8Addr;
	EI_U32 au32Len;
} EI_MADP_SMART_HUMANSNAP_VENC_DATA_S;


typedef struct eiMADP_SMART_HUMANSNAP_RESULTS_S {
	EI_S32 s32HumanId;

	// det
	EI_S32 s32Rect[4];
	EI_FLOAT f32Score;
	EI_S32 s32Area;

	EI_S32 s32FrameId;
	EI_MADP_SMART_HUMANSNAP_VENC_DATA_S *pstHumanVencData;
	EI_MADP_SMART_HUMANSNAP_VENC_DATA_S *pstBgVencData;

	EI_U64 u64Timestamp;

} EI_MADP_SMART_HUMANSNAP_RESULTS_S;

typedef EI_S32 (*EI_MADP_SMART_HumanCap_SnapDataCB)(EI_HANDLE hHumanCap,
	EI_MADP_SMART_HUMANSNAP_RESULTS_S *pstSmartHumanSnapResults, EI_VOID *pPrivData);

/** the attribute of smart human cap*/
typedef struct eiMADP_SMART_HUMANCAP_S {
	/* init attr start*/
	EI_HANDLE Vproc;
	EI_HANDLE Vport;
	EI_HANDLE VencChn;
	EI_HANDLE Cap;
	EI_HANDLE Det;
	EI_HANDLE Trk;

	/*0: default use internal get frame*/
	/*1: using external frame (interface: EI_MAI_Smart_Human_FrameCb or MAI_Smart_Human_SendFrame) */
	EI_S32 s32UsingExternalFrame;

	EI_U32 u32FrameWidth;
	EI_U32 u32FrameHeight;

	/* human det */
	EI_S32 s32HumanDetModle; /* 0: humoid 1:humfacedet */
	EI_S32 s32MaxDetHumanNum;
	EI_MADP_SMART_HumanDet_DataCB pfnDetDataCB;
	EI_VOID *pPrivateDetData;

	/* human trk */
	EI_S32 s32EnHumanTrk;
	EI_S32 s32UseFakeTrk; /* when s32EnHumanTrk == 0; */
						 /*0:  disable fake trk ; 1: enable max area fake trk */
	EI_MADP_SMART_HumanTrk_DataCB pfnTrkDataCB;
	EI_VOID *pPrivateTrkData;

	EI_S32 EnCapDumpImage;
	EI_MADP_SMART_HumanCap_SnapDataCB pfnCapDataCB;
	EI_VOID *pPrivateCapData;
	EI_S32 s32CapMode;
	EI_S32 s32CapInterval;
	EI_S32 s32CapJpegQuality;
	EI_S32 s32DumpBgImage;
	EI_S32 s32CapMinWidthPx;
	EI_S32 s32CapMaxWidthPx;
	EI_S32 s32CapMinHeightPx;
	EI_S32 s32CapMaxHeightPx;
} EI_MADP_SMART_HUMANCAP_ATTR_S;

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

#endif /* __EI_SMART_HUMAN_H__ */

